﻿
#r "System.Windows.Forms.DataVisualization.dll"
#r @"D:\Study\programming\DotNet\LearnByTest\FSharp\PlayFsChart\packages\MSDN.FSharpChart.dll.0.60\lib\MSDN.FSharpChart.dll"

open System
open System.Drawing 
open System.Windows.Forms
open System.Windows.Forms.DataVisualization.Charting
open MSDN.FSharp.Charting

// ###################################################### //

let makeCurve  color name mapping xs = 
    let points = xs |> List.map (fun x -> x,(mapping x))
    FSharpChart.Line (points,Name = name)
        |> FSharpChart.WithSeries.Style(Color = color)

let xs = [1.0..0.2..100.0]
let curve1 = xs |> makeCurve Color.Red "curve1" (fun x-> (sin 10.0 /x) * 50.0 * cos(x ))
let curve2 = xs |> makeCurve Color.Blue "curve2" (fun x -> (cos 2.0 * x) - 2.0 * (sin x))

FSharpChart.Combine [curve1;curve2]
    |> FSharpChart.WithLegend(Alignment = StringAlignment.Center,Docking = Docking.Top)
    |> FSharpChart.Create

FSharpChart.Rows [curve1;curve2]
    |> FSharpChart.WithMargin(0.0f, 8.0f, 2.0f, 0.0f)
    |> FSharpChart.WithLegend(InsideArea = false,Font=new  Font("Arial" , 8.0f),Alignment = StringAlignment.Center,Docking = Docking.Top)
    |> FSharpChart.Create

